package com.zyf.chapter01.practice.v3;

import com.zyf.chapter01.principle.practice.RequestInfo;

import java.util.ArrayList;

/**
 * 使用全新版本进行测试，兼容易用性
 * 相对于上个版本的代码量有所下降
 * @author yifeng
 * @since v3
 */
public class PerfCounterTest {
    public static void main(String[] args) {
        ConsoleReporter consoleReporter = new ConsoleReporter();
        consoleReporter.startRepeatedReport(60, 60);

        ArrayList<String> emailToAddresses = new ArrayList<>();
        emailToAddresses.add("yifeng@gmail.com");
        EmailReporter emailReporter = new EmailReporter(emailToAddresses);
        emailReporter.startDailyReport();

        MetricsCollector collector = new MetricsCollector();
        collector.recordRequest(new RequestInfo("register", 123, 10234));
        collector.recordRequest(new RequestInfo("register", 123, 10234));
        collector.recordRequest(new RequestInfo("register", 123, 10234));
        collector.recordRequest(new RequestInfo("login", 13, 1023));
        collector.recordRequest(new RequestInfo("login", 123, 10234));

        try {
            Thread.sleep(100000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }
}
